import request from '~/utils/request'

export default {
  // 通过 id 获取文章信息
  getArticleById(id) {
    return request({
      url: `/reception/article/public/getArticleById/${id}`,
      method: 'get'
    })
  },

  // 上传文章图片
  uploadFile(data) {
    return request({
      url: '/file/local/uploadArticleFile',
      method: 'post',
      data
    })
  },

  // 新增文章
  addArticle(data) {
    return request({
      url: '/reception/article/inner/addArticle',
      method: 'post',
      data
    })
  },

  // 获取文章列表
  getArticleList(page, pageSize, data) {
    return request({
      url: `/reception/article/public/getArticleList/${page}/${pageSize}`,
      method: 'post',
      data
    })
  },

  // 获取文章列表
  getArticleListByUserId(data) {
    return request({
      url: `/reception/article/getArticleListByUserId`,
      method: 'post',
      data
    })
  },

  // 新增文章评论
  addArticleComments(data) {
    return request({
      url: `/reception/article/inner/addArticleComments`,
      method: 'post',
      data
    })
  },

  // 查询评论
  getArticleComments(articleId) {
    return request({
      url: `/reception/article/public/getArticleComments/${articleId}`,
      method: 'get',
    })
  },

  // 删除单个文章
  deleteByIds(articleId) {
    return request({
      url: `/reception/article/${articleId}`,
      method: 'delete',
    })
  }
}
